@Target(value={METHOD,ANNOTATION_TYPE}) @Retention(value=RUNTIME) @MessageMapping @Documented public @interface JmsListener
destination()
. The containerFactory()
identifies the JmsListenerContainerFactory
to use to build the jms listener container. If not
set, a default container factory is assumed to be available with a bean
name of jmsListenerContainerFactory
unless an explicit default has been
provided through configuration.
Processing of @JmsListener
annotations is performed by
registering a JmsListenerAnnotationBeanPostProcessor
. This can be
done manually or, more conveniently, through the <jms:annotation-driven/>
element or EnableJms
annotation.
Annotated methods are allowed to have flexible signatures similar to what
MessageMapping
provides, that is
javax.jms.Session
to get access to the JMS sessionjavax.jms.Message
or one if subclass to get access to the raw JMS messageMessage
to use the messaging abstraction counterpart@Payload
-annotated method
arguments including the support of validation@Header
-annotated method
arguments to extract a specific header value, including standard JMS headers defined by
JmsHeaders
@Headers
-annotated
argument that must also be assignable to Map
for getting access to all
headers.MessageHeaders
arguments for
getting access to all headers.MessageHeaderAccessor
or JmsMessageHeaderAccessor
for convenient access to all method arguments.Annotated method may have a non void
return type. When they do, the result of the
method invocation is sent as a JMS reply to the destination defined by either the
JMSReplyTO
header of the incoming message. When this value is not set, a default
destination can be provided by adding @SendTo
to the method declaration.
EnableJms
,
JmsListenerAnnotationBeanPostProcessor
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
destination
The destination name for this listener, resolved through the container-wide
DestinationResolver strategy. |
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
concurrency
The concurrency for the listener, if any.
|
java.lang.String |
containerFactory
The bean name of the
JmsListenerContainerFactory
to use to create the message listener container responsible to serve this endpoint. |
java.lang.String |
id
The unique identifier of the container managing this endpoint.
|
java.lang.String |
selector
The JMS message selector expression, if any
|
java.lang.String |
subscription
The name for the durable subscription, if any.
|
public abstract java.lang.String destination
DestinationResolver
strategy.public abstract java.lang.String id
if none is specified an auto-generated one is provided.
public abstract java.lang.String containerFactory
JmsListenerContainerFactory
to use to create the message listener container responsible to serve this endpoint.
If not specified, the default container factory is used, if any.
public abstract java.lang.String subscription
public abstract java.lang.String selector
See the JMS specification for a detailed definition of selector expressions.
public abstract java.lang.String concurrency
The concurrency limits can be a "lower-upper" String, e.g. "5-10", or a simple upper limit String, e.g. "10" (the lower limit will be 1 in this case).
The underlying container may or may not support all features. For instance, it may not be able to scale: in that case only the upper value is used.